package com.engine4cloud.tdf.education.controller.web;

import com.engine4cloud.tdf.common.core.util.R;
import com.engine4cloud.tdf.common.data.web.response.PageInfo;
import com.engine4cloud.tdf.common.data.web.response.Params;
import com.engine4cloud.tdf.education.dto.query.EduStudentTaskQueryDTO;
import com.engine4cloud.tdf.education.dto.result.EduStudentCourseResultDTO;
import com.engine4cloud.tdf.education.service.EduStudentService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springdoc.core.annotations.ParameterObject;
import org.springframework.http.HttpHeaders;
import org.springframework.web.bind.annotation.*;

/**
 * 课程学生关系
 *
 * @author wenjie
 * @date 2024-07-30 14:59:31
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/web/course/student")
@Tag(description = "eduCourseStudent", name = "课程学生关系-web")
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class EduCourseStudentWebController {

    private final EduStudentService studentService;

    /**
     * 分页查询
     *
     * @param page 分页对象
     * @param dto  学员
     * @return R<PageInfo < EduStudentResultDTO>>
     */
    @Operation(summary = "分页查询", description = "分页查询")
    @GetMapping("/page")
    public R<PageInfo<EduStudentCourseResultDTO>> pageList(@ParameterObject Params page, @Valid @ParameterObject EduStudentTaskQueryDTO dto) {
        return R.ok(studentService.pageList(page, dto));
    }
}